Path: blob/master/src/packages/next/pages/[owner].tsx
1447 views
/*1* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45// Route given by an account or organization name.67import getOwner from "lib/names/owner";8import getAccountInfo from "lib/share/get-account-info";9import Account from "components/account/account";10import withCustomize from "lib/with-customize";1112export default function Owner(props) {13if (props.type == "account") {14return <Account {...props} />;15}16// TODO17return (18<div style={{ margin: "30px" }}>19<h1>Organization: {props.owner}</h1>20Organization pages are under construction and not yet available.21</div>22);23}2425export async function getServerSideProps(context) {26const { owner } = context.params;27let info;28try {29info = await getOwner(owner);30} catch (_err) {31//console.log(_err);32return { notFound: true };33}34if (info.type == "account") {35const accountInfo = await getAccountInfo(info.owner_id, context.req);36return await withCustomize({ context, props: { ...info, ...accountInfo } });37}3839return await withCustomize({ context, props: { owner, ...info } });40}414243